// copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
// see COPYRIGHT for reuse legalities
//


#import "TCLCommand.h"

@implementation TCLCommand

- init
{
  [super init];
  cmd = NULL;

  return self;
}

- free
{
  if (cmd)
  {  free(cmd);
  }

  return [super free];
}

- setCmd:(const char *)newCmd
{
  if (cmd)
  {  free(cmd);
  }
  if (newCmd)
  {  cmd = NXCopyStringBuffer(newCmd);
  }
  else
  {  cmd = NULL;
  }
  return self;
}

- (const char *)cmd { return (const char *)cmd; }


- renderSelf:(WW3DCamera *)camera  startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime
{
  RiArchiveRecord("comment", cmd); 
  return self;
}

- renderSelf:(WW3DCamera *)camera
{
  RtFloat  shutterOpenTime = [camera shutterOpenTime],
           shutterCloseTime = [camera shutterCloseTime];


  return [self renderSelf:camera startingAt:shutterOpenTime endingAt:shutterCloseTime];
}

- writeEve:(NXStream *)stream atTabLevel:(int)tab
{
   int  i;


   for (i = 0; i < tab; i++)
   {  NXPrintf(stream, "\t");
   }
   NXPrintf(stream, "ArchiveRecord comment {%s};", cmd); 
   return self;
}


@end

